package com.cn.zmc.design.strategy.factory;

import com.cn.zmc.design.strategy.service.StrategyService;
import com.cn.zmc.design.strategy.service.impl.StrategyAServiceImpl;
import com.cn.zmc.design.strategy.service.impl.StrategyBServiceImpl;
import com.cn.zmc.design.strategy.service.impl.StrategyCServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class StrategyFactory {
    
    @Autowired
    StrategyAServiceImpl strategyAService;
    
    @Autowired
    StrategyBServiceImpl strategyBService;
    
    @Autowired
    StrategyCServiceImpl strategyCService;
    
    
    public StrategyService invoke(int type) {
        if (type == 1) {
            return strategyAService;
        } else if (type == 2) {
            return strategyBService;
        } else {
            return strategyCService;
        }
    }
    
}
